package cn.fulong.sso.client.constant;


/**
 * @Version 1.0
 * @Author: 云树
 * @Description:
 * @Date: 2019/3/8
 * @Modify 云树
 * @ModifyDate 2019/3/8
 * @since 1.0
 */

public class SSOConstants {
    /*********************Session常量******************************/
    public static class Session {
        public static final String TOKEN = "SSO_TOKEN";
        public static final String STATE = "SSO_STATE";
    }

    /*********************sso.client配置参数******************************/
    public static class Api {
        public static final String AUTH_INFO_URL_SUFFIX = "api/auth_info";
    }

    /*********************sso.client syn******************************/
    public static class Syn {
        public static final String SEQ_SESSION = "SSO_CLIENT_SYN_SEQ";
        public static final int SEQ_MAX = 127;
        public static final int SEQ_MIN = 1;
    }


    /*********************sso.server url携带返回参数******************************/
    public static class ServerUrlParams {
        /**
         * 请求url访问码name
         */
        public static final String ACCESS_CODE = "_access_code";
        /**
         * sso.server重定向到sso子系统携带参数名，标识已验证登录状态
         */
        public final static String ACK = "_ack";
        /**
         * sso.server重定向到sso子系统携带参数名，标识需要授权获取登录信息
         */
        public final static String AUTH = "_auth";
        /**
         * sso.server重定向到sso子系统携带参数名，用于保持请求和回调的状态，授权请求后原样带回给第三方，建议sso.client使用此参数，校验state参数防止挟持
         */
        public final static String STATE = "_state";
    }

    /*********************sso.server api响应结果******************************/
    public static class ServerApiReponse {
        /***API返回结果***/
        public final static String CODE = "code";
        public final static String DATA = "data";
        public final static String MSG = "msg";
        public final static String TOKEN = "token";
    }


    /*********************sso.client url 携带请求参数******************************/
    public static class ClientParams {
        /**
         * 发生给sso.server，验证是否登录标识
         */
        public final static String SYN = "syn";
        public final static String APPID = "appid";
        /**
         * 授权请求后原样带回，建议第三方带上该参数，可设置为简单的随机数加session进行校验
         */
        public final static String STATE = "state";
        //只需要授权基本信息
        public final static String SCOPE_BASE = "";
        //获取授权信息及用户基本信息，scope=user_info
        public final static String SCOPE_USER_INFO = "user_info";
    }

    /************ sso.api响应结构状态吗************/
    public static class ApiStatus {
        public static final String SUCCESS = "1";
        public static final String FAIL = "0";
        public static final String CODE_INVALID = "code_invalid";
    }

    /**************客户端配置相关****************/
    public static class ClientConfig {
        public static final String APP_ID = "appId";
        public static final String PUBLIC_SSO_SERVER = "public_sso_server";
        public static final String LOCAL_SSO_SERVER = "local_sso_server";
        public static final String EXCLUSIONS = "exclusions";
        public static final String INCLUDES = "includes";
        public static final String AUTHC = "authc";
        public static final String ANON = "anon";

    }
}
